package store

import (
	"log/slog"
	"os"
	"trader/config"
)

func SetLogger(log config.Log) {
	opts := &slog.HandlerOptions{
		Level: slog.LevelDebug,
	}

	l := slog.Level(0)
	_ = l.UnmarshalText([]byte(log.Level))
	opts = &slog.HandlerOptions{
		Level: l,
	}

	logger := slog.New(slog.NewTextHandler(os.Stdout, opts))
	slog.SetDefault(logger)
}
